﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MediatorPattern.DemoOne
{
    /// <summary>
    /// 庫存管理
    /// </summary>
    public class Stock
    {
        /// <summary>
        /// 剛開始有100台電腦
        /// </summary>
        private static int COMPUTER_NUMBER = 100;

        /// <summary>
        /// 庫存增加
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public void increase(int number)
        {
            COMPUTER_NUMBER = COMPUTER_NUMBER + number;

        }

        /// <summary>
        /// 庫存降低
        /// </summary>
        /// <param name="number"></param>
        public void decrease(int number)
        {
            COMPUTER_NUMBER = COMPUTER_NUMBER - number;
        }
        /// <summary>
        /// 獲得庫存數量
        /// </summary>
        /// <returns></returns>
        public int getStockNumber()
        {
            return COMPUTER_NUMBER;
        }

        /// <summary>
        /// 存貨壓力大了，就要通知採購人員不要採購，銷售人員要尽快銷售
        /// </summary>
        public void clearStock()
        {
            Purchase puchase = new Purchase();

            Sale sale = new Sale();

            sale.offSale();

            puchase.refuseBuyIBM();
         
        }
    }
}
